PAGE 1

Piecewise Function Analysis

2. Function Definition

The function \( g(t) \) is defined using unit step functions as follows:

\[ g(t) = (t-3)u_2(t) - (t-2)u_3(t) \]

This can be rewritten as a piecewise function:

\[ g(t) = \begin{cases} 0 & t < 2 \\ t-3 & 2 \le t < 3 \\ t-3-(t-2) = -1 & t \ge 3 \end{cases} \]

Graphical Representation

The graph of \( g(t) \) shows a zero value until \( t=2 \), a linear segment with a positive slope from \( t=2 \) to \( t=3 \), and a constant value of \( -1 \) for \( t \ge 3 \).

Graph of g(t) with a linear segment from (2,-1) to (3,0) and a horizontal line at -1 for t > 3.
3.">
PAGE 2

Laplace Transform of Piecewise Functions

13. Function Definition

\[ f(t) = \begin{cases} 0 & t < 2 \\ (t-2)^2 & t \ge 2 \end{cases} \]

Find the Laplace Transform (LT) of \( f(t) \).

Laplace Transform Property

Using the second shifting theorem:

\[ \mathcal{L} \{ u_c(t) f(t-c) \} = e^{-cs} \mathcal{L} \{ f(t) \} \]

In this case, \( c = 2 \) and the shifted function is \( (t-2)^2 \). The original function \( f(t) \) used in the transform is the same shape but starting at \( t=0 \), which is \( t^2 \).

Graph showing a parabola (t-2)^2 starting at t=2 and its shifted version t^2 starting at t=0.

Calculation Steps

To find the unshifted function:

  • Take \( (t-2)^2 \) and shift LEFT 2 units.
  • Change \( t \) to \( t+2 \).
  • \( (t+2-2)^2 = t^2 \)

Therefore, the Laplace transform is:

\[ \mathcal{L} \{ f(t) \} = e^{-2s} \mathcal{L} \{ t^2 \} = e^{-2s} \frac{2}{s^3} \]
PAGE 3

23. Laplace Transform Example

\[ F(s) = \frac{(s-2)e^{-s}}{s^2 - 4s + 3} \]

Using the property:

\[ \mathcal{L} \{ u_c(t) f(t-c) \} = e^{-cs} \mathcal{L} \{ f(t) \} \]

Continuing the calculation:

\[ = e^{-s} \frac{s-2}{(s-3)(s-1)} \]
\[ = e^{-s} \left[ \frac{1}{2} \frac{1}{s-3} + \frac{1}{2} \frac{1}{s-1} \right] \]

The term in brackets corresponds to the inverse transform:

\[ \frac{1}{2} e^{3t} + \frac{1}{2} e^t \]

shifted by \( t-1 \)

Final result for \( f(t) \):

\[ f(t) = \frac{1}{2} u_1(t) \left[ e^{3(t-1)} + e^{(t-1)} \right] \]

Note on hyperbolic functions:

\[ \cosh x = \frac{e^x + e^{-x}}{2} \]
PAGE 4

6.4 DEs with Discontinuous Forcing Functions

Example

\[ y'' + y = \begin{cases} 1 & \pi \le t < 2\pi \\ 0 & 0 \le t < \pi, \, t \ge 2\pi \end{cases} \]

Initial conditions: \( y(0) = 0, \, y'(0) = 1 \)

A plot of a pulse function on a t-axis, equal to 1 on the interval [pi, 2 pi) and 0 otherwise.

Express right side with step functions

\[ y'' + y = u_{\pi}(t) - u_{2\pi}(t) \]

Taking the Laplace transform of both sides:

\[ s^2 Y - s y(0) - y'(0) + Y = \frac{e^{-\pi s}}{s} - \frac{e^{-2\pi s}}{s} \]

Substituting initial conditions and simplifying:

\[ (s^2 + 1) Y = e^{-\pi s} \left( \frac{1}{s} \right) - e^{-2\pi s} \left( \frac{1}{s} \right) + 1 \]
PAGE 5

Laplace Transform Solution: Final Steps

Continuing from the previous steps, we express the Laplace transform of the solution as:

\[ Y = e^{-\pi s} \frac{1}{s(s^2+1)} - e^{-2\pi s} \frac{1}{s(s^2+1)} + \frac{1}{s^2+1} \]

Using partial fraction decomposition, where \(\frac{1}{s(s^2+1)} = \frac{1}{s} - \frac{s}{s^2+1}\), we rewrite the expression:

\[ Y = \frac{1}{s^2+1} + e^{-\pi s} \left( \frac{1}{s} - \frac{s}{s^2+1} \right) - e^{-2\pi s} \left( \frac{1}{s} - \frac{s}{s^2+1} \right) \]

Note that the inverse Laplace transform of \(\frac{1}{s} - \frac{s}{s^2+1}\) is \(1 - \cos(t)\).

Applying the second shifting theorem, we find the time-domain solution \(y(t)\):

\[ y(t) = \sin(t) + u_{\pi}(t) [ 1 - \cos(t-\pi) ] - u_{2\pi}(t) [ 1 - \cos(t-2\pi) ] \]

Using trigonometric identities \(\cos(t-\pi) = -\cos(t)\) and \(\cos(t-2\pi) = \cos(t)\), the expression simplifies to:

\[ y = \sin(t) + u_{\pi}(t) ( 1 + \cos t ) - u_{2\pi}(t) ( 1 - \cos t ) \]

This can be written as a piecewise function:

\[ y(t) = \begin{cases} \sin(t) & t < \pi \\ \sin(t) + 1 + \cos(t) & \pi \le t < 2\pi \\ \sin(t) + 1 + \cos(t) - 1 + \cos(t) = \sin(t) + 2\cos(t) & t \ge 2\pi \end{cases} \]
PAGE 6

Graphical Representation of the Solution

The following graph illustrates the behavior of the solution \(y(t)\) over time, showing the transitions at the step points \(t = \pi\) and \(t = 2\pi\).

A plot of y(t) vs t. The curve starts as a sine wave, changes at t approx 3.14 and 6.28, marked with red dots.
PAGE 7

Example: Solving a Differential Equation with a Piecewise Forcing Function

Consider the following second-order linear differential equation with initial conditions:

\[ y'' + y = \begin{cases} 0 & 0 \le t < 1 \\ \frac{t-1}{4} & 1 \le t < 5 \\ 1 & t \ge 5 \end{cases} \]

Initial conditions: \( y(0) = y'(0) = 0 \).

Visualizing the Forcing Function

The forcing function is zero until \( t=1 \), then increases linearly with a slope of \( 1/4 \) until \( t=5 \), where it reaches a value of 1 and remains constant.

Graph of the piecewise forcing function showing zero value for t < 1, a linear ramp from t=1 to t=5, and a constant value of 1 for t > 5.
5.">

Expressing the Right Side with Step Functions

We can rewrite the piecewise function using unit step functions \( u_c(t) \):

\[ y'' + y = u_1(t) \left( \frac{t-1}{4} \right) + u_5(t) \left( -\frac{t-1}{4} + 1 \right) \]
Note: The term \( -\frac{t-1}{4} \) cancels the previous ramp (back to 0).
Note: The term \( +1 \) is the target value at \( t=5 \).
PAGE 8

Algebraic Simplification

First, simplify the expression for the forcing function to prepare for the Laplace Transform:

\[ y'' + y = u_1(t) \left( \frac{t-1}{4} \right) + u_5(t) \left( \frac{5}{4} - \frac{t}{4} \right) \] \[ = \frac{1}{4} u_1(t) (t-1) + \frac{1}{4} u_5(t) (5-t) \] \[ y'' + y = \frac{1}{4} u_1(t) (t-1) - \frac{1}{4} u_5(t) (t-5) \]

Note: The terms are now in the form \( u_c(t) f(t-c) \), which is ready for the shift theorem.

Applying the Laplace Transform

Taking the Laplace Transform of both sides (using \( \mathcal{L}\{u_c(t)f(t-c)\} = e^{-cs}F(s) \)):

\[ (s^2 + 1)Y = \frac{1}{4} e^{-s} \left( \frac{1}{s^2} \right) - \frac{1}{4} e^{-5s} \left( \frac{1}{s^2} \right) \]

Solving for \( Y(s) \):

\[ Y = \frac{1}{4} e^{-s} \frac{1}{s^2(s^2+1)} - \frac{1}{4} e^{-5s} \frac{1}{s^2(s^2+1)} \]

Partial Fraction Decomposition and Inverse Transform

Using the identity \( \frac{1}{s^2(s^2+1)} = \frac{1}{s^2} - \frac{1}{s^2+1} \):

\[ Y = \frac{1}{4} e^{-s} \left( \frac{1}{s^2} - \frac{1}{s^2+1} \right) - \frac{1}{4} e^{-5s} \left( \frac{1}{s^2} - \frac{1}{s^2+1} \right) \]

The inverse transform of \( \frac{1}{s^2} - \frac{1}{s^2+1} \) is \( t - \sin t \).

Final Step: Now shift RIGHT to find \( y(t) \).
PAGE 9

Piecewise Function Representation

The solution for the displacement function \( y(t) \) is expressed using unit step functions:

\[ y = \frac{1}{4} u_1(t) \left[ (t-1) - \sin(t-1) \right] - \frac{1}{4} u_5(t) \left[ (t-5) - \sin(t-5) \right] \]

This can be rewritten as a piecewise-defined function over different time intervals:

\[ y = \begin{cases} 0 & t < 1 \\ \frac{t-1 - \sin(t-1)}{4} & 1 \le t < 5 \\ \frac{4 - \sin(t-1) + \sin(t-5)}{4} & t \ge 5 \end{cases} \]

MATLAB Implementation

To plot this function in MATLAB, use the fplot command:

fplot('function name', time interval)